﻿import QtQuick 2.1
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls.Private 1.0

ScrollViewStyle {
    id : scrollview
    property int scrollbarWidth : 8
    property color scrollbarBgColor: "#333333"
    property bool hasMouse: false
    scrollBarBackground : Item {
        implicitWidth: scrollview.scrollbarWidth
        implicitHeight: scrollview.scrollbarWidth
        visible : hasMouse
        width: hasMouse?scrollview.scrollbarWidth:1
//        Item {
//            anchors.fill: parent
//            anchors.rightMargin: styleData.horizontal ? -2 : -1
//            anchors.leftMargin: styleData.horizontal ? -2 : 0
//            anchors.topMargin: styleData.horizontal ? 0 : -2
//            anchors.bottomMargin: styleData.horizontal ? -1 : -2
//        }
    }
    frame:Rectangle{
        color: "transparent"
    }
    handle: Rectangle{
        id : theRect
        opacity:(hasMouse || styleData.hovered)?1.0:0
        implicitWidth: styleData.horizontal ? 66 : scrollview.scrollbarWidth
        implicitHeight: styleData.horizontal ? scrollview.scrollbarWidth : 66
        color :scrollbarBgColor
        radius : scrollview.scrollbarWidth
//        Behavior on opacity {
//            NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 }
//        }
        NumberAnimation on opacity { to: 1.0; duration: 1000 }
        NumberAnimation on opacity { to: 0; duration: 1000 }
//        states: [
//            State {
//                name: "clicked"
//                when : styleData.pressed
//                PropertyChanges {target: theRect; opacity : 1}
//            }
//        ]
//        transitions: Transition {
//            PropertyAnimation { properties: "opacity"; easing.type: Easing.InOutQuad; duration: 500 }
//        }
    }
    incrementControl: Item {
        visible : false
        implicitWidth: 0
        implicitHeight: 0
    }
    decrementControl: Item {
        visible : false
        implicitWidth: 0
        implicitHeight: 0
    }
    corner: Rectangle { color: "transparent";visible : false }
}


